package com.dj.common.Aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Aspect
@Component   //定义切面
public class AopAdvice {


  private Logger logger = LoggerFactory.getLogger(AopAdvice.class); //日志对象

    @Pointcut("execution(* com.DJ.controller.*.*(..))") //定义切面 ，所有方法都五无侵入增强日志
    public void Pointcut(){
    }

    @Around("Pointcut()")  //环绕切点
    public Object myLogger (ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        logger.info("Aop增强--工资1800");
        Object proceed = proceedingJoinPoint.proceed();
        logger.info("Aop增强--工资1800000000000");
        return proceed;
    }
}
